<?php
use yii\helpers\Html;
use yii\helpers\Url;

/* @var $model \app\models\Comment */
/* @var $child \app\models\Comment */

?>
<?php foreach ($models as $model): ?>
    <div class="mui-card">
        <div class="mui-card-header mui-card-media">
            <img src="<?= $model->user->getAvatar(); ?>"/>
            <div class="mui-media-body">
                <?= Html::encode($model->user->uname); ?>
                <p><?= date('Y-m-d', $model->ctime); ?></p>
            </div>
        </div>
        <div class="mui-card-content">
            <?= Html::encode($model->content); ?>
        </div>
        <div class="mui-card-footer">
            <div style="width:100%;">
                <a id="<?= $model->id; ?>" class="btn-dp J-commentOpenPopOver">
                    <i class="iconfont">&#xe615;</i>评
                </a>
                <a id="<?= Url::to(['comment/like', 'id' => $model->id]); ?>" class="btn-love comments_like">
                    <i class="iconfont icon-love1"></i><span><?= $model->likes; ?></span>
                </a>
            </div>
        </div>
        <?php if($model->children): foreach ($model->children as $child): ?>
        <div class="commet-content-replay">
            <a><?= Html::encode($child->user->uname); ?></a>
            <?= Html::encode($child->content); ?>
        </div>
        <?php endforeach; endif; ?>
    </div>
<?php endforeach; ?>